﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using Model;

namespace HouseProperty.Controllers
{
    public class LoginController : Controller
    {
        //
        // GET: /Login/
        bll bll = new bll();
        /// <summary>
        /// 登录视图
        /// </summary>
        /// <returns></returns>
        public ActionResult Login()
        {
            return View();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Users_Account"></param>
        /// <param name="Users_Pwd"></param>
        /// <returns></returns>
        public int LoginDo(string Users_Account, string Users_Pwd)
        {
            //
            var su = bll.Login(Users_Account);
            if (su == null)
                return 0;
            if (su.users_Pwd != Users_Pwd)
                return 1;
            if (su.users_IsState == 0)
                return 3;
            Session["LoginUser"] = su;
            return 2;


        }

        /// <summary>
        ///  退出登录
        /// </summary>
        /// <returns></returns>
        public int returnLogin()
        {
            Session["LoginUser"] = null;
            return 1;
        }


    }
}
